package cn.iocoder.yudao.module.member.controller.app.usercidbind;

import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;

import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;

import javax.validation.constraints.*;
import javax.validation.*;
import javax.servlet.http.*;
import java.util.*;
import java.io.IOException;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;

import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;

import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*;

import cn.iocoder.yudao.module.member.controller.app.usercidbind.vo.*;
import cn.iocoder.yudao.module.member.dal.dataobject.usercidbind.UserCidBindDO;
import cn.iocoder.yudao.module.member.convert.usercidbind.UserCidBindConvert;
import cn.iocoder.yudao.module.member.service.usercidbind.UserCidBindService;

@Tag(name = "用户 APP - 推送绑定的id")
@RestController
@RequestMapping("/member/user-cid-bind")
@Validated
public class AppUserCidBindController {

    @Resource
    private UserCidBindService userCidBindService;

//    @PostMapping("/create")
//    @Operation(summary = "创建推送绑定的id")
//
//    public CommonResult<Long> createUserCidBind(@Valid @RequestBody AppUserCidBindCreateReqVO createReqVO) {
//        return success(userCidBindService.createUserCidBind(createReqVO));
//    }

//    @PutMapping("/update")
//    @Operation(summary = "更新推送绑定的id")
//
//    public CommonResult<Boolean> updateUserCidBind(@Valid @RequestBody AppUserCidBindUpdateReqVO updateReqVO) {
//        userCidBindService.updateUserCidBind(updateReqVO);
//        return success(true);
//    }
    @PutMapping("/updateOrInsert")
    @Operation(summary = "更新推送绑定的id")

    public CommonResult<Boolean> updateOrInsertUserCidBind(@Valid @RequestBody AppUserCidBindCreateReqVO createReqVO) {
        userCidBindService.saveOrUpdateCidBind(createReqVO);
        return success(true);
    }

//    @DeleteMapping("/delete")
//    @Operation(summary = "删除推送绑定的id")
//    @Parameter(name = "id", description = "编号", required = true)
//
//    public CommonResult<Boolean> deleteUserCidBind(@RequestParam("id") Long id) {
//        userCidBindService.deleteUserCidBind(id);
//        return success(true);
//    }
//
//    @GetMapping("/get")
//    @Operation(summary = "获得推送绑定的id")
//    @Parameter(name = "id", description = "编号", required = true, example = "1024")
//
//    public CommonResult<AppUserCidBindRespVO> getUserCidBind(@RequestParam("id") Long id) {
//        UserCidBindDO userCidBind = userCidBindService.getUserCidBind(id);
//        return success(UserCidBindConvert.INSTANCE.convert(userCidBind));
//    }
//
//    @GetMapping("/list")
//    @Operation(summary = "获得推送绑定的id列表")
//    @Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")
//
//    public CommonResult<List<AppUserCidBindRespVO>> getUserCidBindList(@RequestParam("ids") Collection<Long> ids) {
//        List<UserCidBindDO> list = userCidBindService.getUserCidBindList(ids);
//        return success(UserCidBindConvert.INSTANCE.convertList(list));
//    }
//
//    @GetMapping("/page")
//    @Operation(summary = "获得推送绑定的id分页")
//
//    public CommonResult<PageResult<AppUserCidBindRespVO>> getUserCidBindPage(@Valid AppUserCidBindPageReqVO pageVO) {
//        PageResult<UserCidBindDO> pageResult = userCidBindService.getUserCidBindPage(pageVO);
//        return success(UserCidBindConvert.INSTANCE.convertPage(pageResult));
//    }
//
//    @GetMapping("/export-excel")
//    @Operation(summary = "导出推送绑定的id Excel")
//
//    @OperateLog(type = EXPORT)
//    public void exportUserCidBindExcel(@Valid AppUserCidBindExportReqVO exportReqVO,
//              HttpServletResponse response) throws IOException {
//        List<UserCidBindDO> list = userCidBindService.getUserCidBindList(exportReqVO);
//        // 导出 Excel
//        List<AppUserCidBindExcelVO> datas = UserCidBindConvert.INSTANCE.convertList02(list);
//        ExcelUtils.write(response, "推送绑定的id.xls", "数据", AppUserCidBindExcelVO.class, datas);
//    }

}
